package statefulset

import (
	"kms-backend/controllers"
	"kms-backend/utils/logs"

	"github.com/dotbalo/kubeutils/kubeutils"
	"github.com/gin-gonic/gin"
	appsv1 "k8s.io/api/apps/v1"
)

func Update(r *gin.Context) {
	logs.Debug(nil, "更新statefulset")
	var statefulset appsv1.StatefulSet
	info := controllers.Info{}
	info.Item = &statefulset
	kubeconfig := controllers.NewInfo(r, &info, "更新statefulset成功")
	// 使用kubeutils接口创建statefulset
	var kubeUtilser kubeutils.KubeUtilser
	instance := kubeutils.NewStatefulSet(kubeconfig, &statefulset)
	// 把实例赋值给kubeUtilser
	kubeUtilser = instance
	// 使用kubeUtilser创建
	info.Update(r, kubeUtilser)

}
